package com.chis.ms;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 
 * @Description 
 * @Company zwx
 * @author wlj
 * @version 2019年04月25日
 */
public class Test3 {

    public static void main(String[] args) {
        File file1 = new File("C:\\Users\\wlj\\Desktop\\batnmb.txt");
        FileReader m = null;
        try {
            m = new FileReader(file1);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        BufferedReader reader = new BufferedReader(m);
        StringBuilder sb = new StringBuilder();
        int i =0;
        while (true) {
            String nextline = null;
            try {
                nextline = reader.readLine();
                if(nextline != null && !nextline.equals("") && !nextline.contains("----") && !nextline.contains("BATNMB")){
//                    System.out.println(nextline.replace("|","").trim());
                    sb.append(nextline.replace("|","").trim()).append(",");
                    i++;
                }

            } catch (IOException e) {
                e.printStackTrace();
            }
            if (nextline == null) break;
        }
        System.out.println(i);
        System.out.println(sb.toString());



    }




}
